﻿using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace UWBGL_XNA_Lib13
{
	public class CustomizedStar : UWB_PrimitiveStar
	{
		private int numberOfEdges;
		private float innerOutterRadiusRatio0to1;

		public CustomizedStar() : base()
		{
			numberOfEdges = 20;
			innerOutterRadiusRatio0to1 = .7f;
		}

		protected override void drawPrimitive(eLevelofDetail lod, UWB_DrawHelper drawHelper)
		{
			eLevelofDetail oldLod = drawHelper.getLod();
			drawHelper.setLod(lod);
			drawHelper.drawStar(mCenter, mRadius, numberOfEdges, innerOutterRadiusRatio0to1);
			drawHelper.setLod(oldLod);
		}

		// modifying # of edges
		public int edges
		{
			get { return numberOfEdges; }
			set 
			{
				if (value > 0)
					numberOfEdges = value;
			}
		}

		// modifying the inside diameter of the star primitive
		public float innerRingSize
		{
			get { return innerOutterRadiusRatio0to1; }
			set 
			{
				if (value >= 0 && value <= 1)
					innerOutterRadiusRatio0to1 = value;
			}
		}
	}
}